<script>
import * as echarts from 'echarts';
export default {
  name: "index",
  mounted() {
    let chartDom = document.getElementById('main');
    let myChart = echarts.init(chartDom);
    let option;

    option = {
      title: [
        {
          text: '客户数据总览'
        }
      ],
      xAxis: {
        type: 'category',
        data: ['202401', '202402', '202403', '202404', '202405', '202406', '202407', '202408', '202409', '2024010', '2024011', '2024012']
      },
      yAxis: {
        type: 'value'
      },
      series: [
        {
          data: [0, 2, 0, 1, 0, 0, 0,,0,0,0,0],
          type: 'bar',
          showBackground: true,
          backgroundStyle: {
            color: 'rgba(180, 180, 180, 0.2)'
          },
          itemStyle:{
            color:'#fc7474'
          },
          barWidth: '40%' // 修改柱子的宽度，可以是数值或百分比
        }
      ]
    };
// 255 166 166
    option && myChart.setOption(option);
  }
}
</script>

<template>
  <div class="box">
    <div id="main" style="width: 80vw;height: 60vh"></div>
  </div>
</template>

<style scoped lang="scss">
.box{
  margin: 0 auto;
  padding: 20px;
}
</style>
